﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;
using System.ComponentModel.DataAnnotations;
using NHibernate;
using NHibernate.Criterion;

namespace ZdSoft.Model
{
    [ActiveRecord]
    public class Resource : EntityBase
    {
        [Display(Name = "资源名称")]
        [Property]
        public string ResourcesName { get; set; }

        [Display(Name = "资源路径")]
        [Property]
        public string ResourcesUrl { get; set; }

        [Display(Name = "资源类型")]
        [Property]
        public int ResourcesType { get; set; }

        [Display(Name = "资源描述")]
        [Property]
        public string ResourcesInfo { get; set; }

        [Display(Name = "课程")]
        [BelongsTo(Type = typeof(Course), Column = "CourseID")]
        public Course Courses { get; set; }

        [Display(Name = "是否激活")]
        [Property]
        public string IsActive { get; set; }

        [HasAndBelongsToMany(typeof(StudyBatch),
            Table = "Resource_StudyBatch",
            ColumnKey = "ResourceID",
            ColumnRef = "StudyBatchID",
            Cascade = ManyRelationCascadeEnum.None,
            Inverse = false,
            Lazy = false)]
        public IList<StudyBatch> StudyBatchs { get; set; }

    }
}
